#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<string.h>
#define N 20
int main() {
    int nums[N][2] = { 0 };
    getchar();
    for (int i = 0; i < N; i++) {
        int n, m;
        if (scanf("[%d,%d]", &n, &m) != EOF) {
            nums[i][0] = n;
            nums[i][1] = m;
            getchar();
        }
        else break;
    }

    int a, b;
    int sum = 0;
    int maxlen = -999;
    for (int i = 0; i < N; i++) {
        a = nums[i][0];
        b = nums[i][1];
        int t = a > b ? b : a;
        if (t > maxlen) {
            maxlen = t;
            sum = 1;
        }
        else if (t == maxlen) {
            sum++;
        }
    }
    printf("%d", sum);
    return 0;
}